﻿using System;

namespace demo4
{
    class StaticVar
    {
        //静态变量
        public static int num;

        public void count()
        {
            num++;
        }

        //静态函数
        public static int getNum()
        {
            return num;
        }
    }

    class StaticTester
    {
        static void Main(string[] args)
        {
            StaticVar s = new StaticVar();
            s.count();
            s.count();
            s.count();
            Console.WriteLine("变量 num： {0}", StaticVar.getNum());
            Console.ReadKey();
        }
    }
}
